package com.jd.idea.plugin.dialog;

import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class TrauntDialog extends DialogWrapper {

    private JLabel jLabel;
    public TrauntDialog(boolean canBeParent) {
        super(canBeParent);
        setTitle("喝一碗毒鸡汤");
        init();
    }

    /**
     * 创建面板中间内容
     * @return
     */
    @Override
    protected @Nullable JComponent createCenterPanel() {
        JPanel jPanel = new JPanel();
        jLabel = new JLabel();
        jLabel.setText("毒鸡汤内容");
        jPanel.add(jLabel);
        return jPanel;
    }


    @Override
    protected JComponent createSouthPanel() {
        JPanel jPanel = new JPanel();
        JButton jButton = new JButton();
        jButton.setText("再干一碗");
        jButton.addActionListener(e ->{
            jLabel.setText("毒鸡汤内容+ 1");
        });
        jPanel.add(jButton);
        return jPanel;
    }
}
